{% extends "base.html" %}
{% block content %}

<div class="container py-5">
    <h3>📦 订单详情</h3>
    <div class="card shadow-sm border-0 mt-4">
        <div class="card-body">
            <div class="row mb-3">
                <div class="col-md-6">
                    <strong>顾客姓名：</strong> {{ order.user.username }}
                </div>
                <div class="col-md-6">
                    <strong>商品名称：</strong> {{ order.product.product_name }}
                </div>
            </div>

            <div class="row mb-3">
                <div class="col-md-6">
                    <strong>下单时间：</strong> {{ order.created_at|date:"Y-m-d H:i:s" }}
                </div>
                <div class="col-md-6">
                    <strong>订单状态：</strong>
                    <span class="badge bg-success">{{ order.get_status_display }}</span>
                </div>
            </div>

            <!-- 商品图片展示 -->
            <div class="row mb-3 align-items-center">
                <div class="col-md-3 text-center">
                    <strong>商品图片：</strong>
                </div>
                <div class="col-md-9">
                    {% if order.product.product_image %}
                        <img src="{{ order.product.product_image.url }}" alt="商品图片" class="img-fluid rounded" style="max-height: 200px;">
                    {% else %}
                        <p class="text-muted">暂无图片</p>
                    {% endif %}
                </div>
            </div>

            <div class="row mb-3">
                <div class="col-md-6">
                    <strong>原材料来源：</strong> {{ order.product.raw_material_source }}
                </div>
                <div class="col-md-6">
                    <strong>生产过程：</strong> {{ order.product.production_process }}
                </div>
            </div>

            <div class="row mb-3">
                <div class="col-md-6">
                    <strong>检验批次：</strong> {{ order.product.inspection_batch }}
                </div>
                <div class="col-md-6">
                    <strong>物流流转：</strong> {{ order.product.logistics_flow }}
                </div>
            </div>

            <div class="row mb-3">
                <div class="col-md-6">
                    <strong>防伪鉴证：</strong> {{ order.product.anti_counterfeiting_certification }}
                </div>
                <div class="col-md-6">
                    <strong>商品价格：</strong> ¥{{ order.product.price }}
                </div>
            </div>
            <div class="row mb-3">
    <div class="col-md-6">
        <strong>收货地址：</strong>
        {{ order.shipping_address }}
    </div>
    <div class="col-md-6">
        <strong>购买数量：</strong>
        {{ order.quantity }} 件
    </div>
</div>


            <div class="mt-4 d-flex justify-content-between">
                <a href="{% url 'sold_orders_all' %}" class="btn btn-outline-secondary">返回列表</a>
            </div>
        </div>
    </div>
</div>

{% endblock %}
